package com.zc.angelica.controller;

import com.zc.angelica.entity.ResponseData;
import com.zc.angelica.service.RoleAccountInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("/roleAccount")
public class RoleAccountInfoController {

    @Autowired
    private RoleAccountInfoService roleAccountInfoService;

    @GetMapping("/select")
    @PreAuthorize ("hasPermission('addMenu','add')")
    public ResponseData select(Integer pageNo, Integer pageSize){
       return roleAccountInfoService.select(pageNo,pageSize);
    }

    @GetMapping("/binding")
    public ResponseData binding(Long roleId){
        return roleAccountInfoService.binding(roleId);
    }

    @GetMapping("/unbound")
    public ResponseData unbound(Long id){
        return roleAccountInfoService.unbound(id);
    }
}
